package com.reflect;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86184
 * Date: 2023-12-12
 * Time: 9:59
 */
public class Test {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要查询的父类");
        String next = sc.next();

        Class c = Class.forName(next);
        System.out.println("父类："+c.getSuperclass().getName());
        Student s = (Student) c.newInstance();
        s.setAge(20);
        s.setName("zhangsan");
        System.out.println(s);
    }
}
